package com.bear.fastrepair.mvvm.ui.manager

import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import com.bear.fastrepair.mvvm.data.manager.ManagerDataSource
import com.bear.fastrepair.mvvm.data.manager.ManagerRepository

class ManagerViewModelFactory : ViewModelProvider.Factory {
    @Suppress("UNCHECKED_CAST")
    override fun <T : ViewModel?> create(modelClass: Class<T>): T {
        if (modelClass.isAssignableFrom(ManagerViewModel::class.java)) {
            return ManagerViewModel(ManagerRepository(ManagerDataSource())) as T
        }
        throw IllegalArgumentException("Unknown ViewModel class")
    }
}